import axios from 'axios';

const prod = '//123.206.14.38:3000';
const dev = '//localhost:3000';

const ajax = ({url, data, method = 'GET'}) => {
	// 后端接口地址
	const baseURL = dev +  '/v1/admin';
	const config = {baseURL, url, method, headers: {'Content-Type': 'application/x-www-form-urlencoded'}};
	config[method.toLowerCase() === 'get' ? 'params' : 'data'] = (data || {});
	console.log(method)
	console.log(config)
	return axios.request(config);
}

export default ajax;
